package com.zhucan.stream.api;

import com.zhucan.stream.binder.event.OrderEvent;
import com.zhucan.stream.producer.OrderProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhuCan
 * @email zhucan@co-mall.com
 * @description
 * @since 2020/8/20 9:31
 */
@RestController
@RequestMapping("/order")
public class OrderController {

  @Autowired
  private OrderProducer producer;

  @GetMapping("/send")
  public void send(){
    OrderEvent event = new OrderEvent();
    event.setSn("ces");
    producer.publish(event);
  }

  @GetMapping("/send/header")
  public void sendHeader(){
    OrderEvent event = new OrderEvent();
    event.setSn("ces");
    producer.publishHeader(event);
  }

  @GetMapping("/send/route")
  public void sendRoute(){
    OrderEvent event = new OrderEvent();
    event.setSn("ces");
    producer.publishRoute(event);
  }

  @GetMapping("/send/route/test")
  public void sendRouteTest(){
    OrderEvent event = new OrderEvent();
    event.setSn("ces");
    producer.publishRouteTest(event);
  }
}
